# class Person:
#     def __init__(self):
#         print("Person: __init")
#     def __del__(self):
#         print("Person: __del__")
#     def eat(self):
#         print("我会吃饭")
#     def sing(self):
#         print("我是唱歌小能手")
#
# class Girl(Person):
#     def __iter__(self):
#         print("Girl: __init__")
#     def __del__(self):
#         print("Girl: __del__")
#     pass
#
# g = Girl()
# g.sing()
# g.eat()
#

# class Father:
#     def eat(self):
#         print("吃饭")
#     def sleep(self):
#         print("睡觉")
#
#
# class Son(Father):
#     pass
#
# son = Son();
# son.eat()
# son.sleep()
#
# class Grandson(Son):
#     pass
#
# grandson = Grandson()
# grandson.eat()
# grandson.sleep()


# class Father:
#     def money(self):
#         print("一百万需要继承")
# class Man(Father):
#     def money(self):
#         #  super是一个特殊的类，可以调用父类的方法
#         super().money()
#         print("自己赚一百万")
#
# m = Man()
# m.money()
# f = Father()
# f.money()
#



# # 新式类写法，这样会继承objct类,他提供了一些函数
# class Father(object):
#     def money(self):
#         print("拥有一百万财产需要继承")
#
# class Monther(object):
#     def appearance(self):
#         print("绝世容颜需要被继承")
# class Son(Father,Monther):
#     pass
#
# son = Son()
# son.money()
# son.appearance()
# # __mor__可以查看方法的搜索顺序
# print(Son.__mro__)
#

# class Person(object):
#     name = 'lch'
#     def __init__(self):
#         self.age = 18
#     def __del__(self):
#         print(f"年龄是{self.age}")
#         print(f"名字是{self.name}")
#
#     # 静态方法
#     # @staticmethod
#     # def introduce():
#     #     print(f"我是{Person.name}")
#     # # 类方法 其中cls代表了类本身
#     @classmethod
#     def introduce(cls):
#         print(cls.name)
#
# pe = Person()
# pe.introduce()




